{% extends super_template %}
{% load djtools_templatetags %}

{% block content %}        
        
<h1>{{ form.TITLE }}</h1>

{% render_form form %}

<div id="resposta">
	
{% if ocorrencias %}
<!--<a href="javascript:document.location.href=document.location.href+'&pdf=true'"><img src='/media/img/pdf_icone.jpg'/>Gerar Relatório</a>-->
<br />
<form action="/" method="POST">
    <table>
        <thead>
			<tr>
            	<th>#</th>
            	<th>Status</th>
				<th>Categoria</th>
				<th>Setor</th>
				<th>Nº Patrimonio</th>            	
            	<th>Problema</th>
        	</tr>
		</thead>
        <tbody>
            {% for o in ocorrencias %}			
                <tr class="{% cycle row1,row2 %}">                    
                    <td align="center">{{ forloop.counter }}</td>
                    <td>{{ o.status }}</td>
                    <td>{{ o.categoria }}</td>
                    <td>{{ o.setor }}</td>
                    <td>{{ o.numero_patrimonio }}</td>					
					<td>{{ o.problema }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
	<br />
	
	{% if agrupamento %}
	<h4>Agrupado por {{ agrupamento.upper }}</h4>
	<table>
		<thead>
			<tr>
			{% for key, value in dic.items %}
            	<th>{{ key }}</th>
			{% endfor %}
			</tr>
		</thead>
        <tbody>
			<tr>
			{% for key, value in dic.items %}
                <td>{{ value }}</td>
			{% endfor %}
			</tr>
		</tbody>
    </table>
	{% endif %}
	
</form>
{% else %}
    {% ifequal ocorrencias None %}
    {% else %}
        <p>Nenhum item encontrado.</p>
    {% endifequal %}
{% endif %}
</div>

{% endblock %}